#ifndef TABLEMODEL_H
#define TABLEMODEL_H

#include <QAbstractTableModel>
#include "commondef.h"

class TableModel : public QAbstractTableModel
{
public:
    explicit TableModel(QObject *parent = nullptr);

    virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;

    virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;

    QVariant data(const QModelIndex &index, int role) const;

    QVariant headerData(int section, Qt::Orientation orientation, int role) const;

    bool setData(const QModelIndex &index, const QVariant &value, int role);

    void setModelDatas(const VMSV& datas);

    void setHeaders(const QStringList& header) { m_header = header; }

private:

    void checkedData(bool isChecked, const QModelIndex &index);

private:

    VMSV m_datas;
    QStringList m_header;
};

#endif // TABLEMODEL_H
